<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/main.css">
    <style>
        .a {
            color: red;
        }

        .b {
            font-size: 2rem;
        }

        .c {
            border: solid;
        }
    </style>
</head>

<body>

    <div id="box" class="">hello jack</div>

    <script>
        const box = document.getElementById('box');
        // 添加
        box.classList.add('a', 'b', 'c');
        console.log(box.classList.contains('a'));//判断是否存在
        setTimeout(() => {
            //删除
            box.classList.remove('a','b','c');
            console.log(box.classList.contains('a'));
        }, 3000);
        // box.classList.add('a');
        // box.classList.add('b');
        // box.classList.add('c');
    

        // box.setAttribute('class', 'a b c');
        // box.className = 'a b c'

    </script>
</body>

</html>